package alik.notes.server.persistence;

import java.io.Serializable;

import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import alik.notes.shared.data.Note;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class NotePersistable implements Serializable, Note {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2846041051415197836L;
	
	@SuppressWarnings("unused")
	@PrimaryKey
	@Persistent
	private String composedIdKey;
	
	@Persistent
	private String title;
    
    @SuppressWarnings("unused")
    @Persistent
    private String userId;

    @Persistent
    private String description;

    @Persistent
    private long lastEditDate;

	
	
	
	public NotePersistable() {
		super();
	}

	public NotePersistable(String title, String description, long lastEditDate, String userId) {
		super();
		this.composedIdKey = new ComposedIdKey(title, userId).toString();
		this.title = title;
		this.description = description;
		this.lastEditDate = lastEditDate;
		this.userId = userId;
	}
	
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public long getLastEditDate() {
		return lastEditDate;
	}
	public void setLastEditDate(long lastEditDate) {
		this.lastEditDate = lastEditDate;
	}
	
	
}
